package org.example.controller;

import org.example.domain.NitAdmin;
import org.example.service.impl.NitAdminServiceImpl;
import org.example.untils.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("nitAdmin")
public class NitAdminController {

    @Autowired
    private NitAdminServiceImpl nitAdminServiceImpl;

    @PostMapping("/login")
    public Result login(@RequestBody NitAdmin nitAdmin){
        NitAdmin backNitAdmin= nitAdminServiceImpl.login(nitAdmin);
        if(backNitAdmin==null){
            return new Result(201,"登入失败~",null);
        } else {
            return new Result(200,"登入成功~",backNitAdmin);
        }
    }

}
